<?php
// check for the site ID - if not, then stop
if (!$_GET['st']){
	exit("NO COMPANY ID");
}else{
	$siteID=$_GET['st'];
}
include('config/config.php');
// LOAD THE CLASSES
DM::loadClass('tracker','info');
DM::loadClass('tracker','charset');
DM::loadClass('tracker','lang');
DM::loadClass('tracker','uagent');
DM::loadClass('tracker','page');
DM::loadClass('tracker','log');

// PREP THE INFORMATION
$i = new info();
$pg = new page();
$cs = new charset();
$ln = new lang();
$ua = new uagent();
$lg = new log();
// SAVE THE STUFF
/*
	var $id_page = "";
	var $id_site = "";
	var $txt_url = "";
	var $txt_query = "";
	var $title = "";
*/
$pg->id_site=$siteID;
$pg->txt_url=$i->referer;
$pg->txt_query=$i->query;
$pg->title=$i->url;
$cs->multiplesave($i->charset);
$pg->checkSave();
$ln->multiplesave($i->lang);
$ua->txt_uagent = $i->ua;
$ua->checkSave();

$lg->id_charset = join(",", $cs->lista);
$lg->id_lang = join(",",$ln->lista);
$lg->id_page = $pg->id_page;
$lg->id_site = $siteID;
$lg->id_uagent= $ua->id_uagent;
$lg->ip4 = $_SERVER['REMOTE_ADDR'];
$lg->timestamp = date('Y-m-d H:j:s');
$lg->id_query = $_SERVER['QUERY_STRING'];
//exit($_SERVER['QUERY_STRING']);
$lg->save();

exit();
// DEBUGGIN OUTPUT
echo "alert('HHHHH')";
//phpinfo();
?>